<template>
  <div class="scene_content">
    <div class="scene_box container">
      <span class="scene_item" v-for="item in 10" :key="item" @click="handleItem(item)"
        :class="['scene_button', `${item - 1}` === activeItem ? 'active' : '']">场 景 {{ item }}</span>

    </div>
    <div class="btn_group">
      <div class="scene_item btnA" @click="call">场景调用</div>
      <div class="scene_item btnA" @click="save">场景保存</div>
      <div class="scene_item btnA" @click="del">场景删除</div>
    </div>
  </div>
</template>

<script>
import { LMX_sendDataApi } from "../api/qiehuan";

export default {
  name: "Scene",

  data() {
    return {
      activeItem: null,
    };
  },
  mounted() {
  },
  methods: {
    handleItem(item) {
      this.activeItem = `${item - 1}`;
    },
    call() {
      LMX_sendDataApi({
        callScene: {
          sid: this.activeItem,
        },
      }).then(() => {
        this.$message.success("调用成功");
      });
    },
    save() {
      LMX_sendDataApi({
        saveScene: {
          sid: this.activeItem,
        },
      }).then(() => {
        this.$message.success("保存成功");
      });
    },

    del() {
      LMX_sendDataApi({
        delScene: {
          sid: this.activeItem,
        },
      }).then(() => {
        this.$message.success("删除成功");
      });
    },
  },
};
</script>

<style scoped lang="scss">

.active {
  background: linear-gradient(0deg, #80bb09, #aed54d) !important;
}

.btnA{
   background: linear-gradient(0deg, #006db2, #6ad2f9) !important;

   &:hover{
    background: linear-gradient(0deg, #0308d3, #75b3ff) !important;
   }
}

.scene_item {
  cursor: pointer;
  height: 60px;
  line-height: 60px;
  text-align: center;
  font-size: 30px;
  font-weight: 500;
  background: linear-gradient(0deg, #0308d3, #75b3ff);
  border-radius: 5px;
}

.scene_content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 400px;
  margin-top: 150px;
    background: #13037d;

  .scene_box {
    display: grid;
    width: 60%;
    height: 100%;
    grid-template-rows: 1fr 1fr;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    gap: 50px;
    grid-template-areas:
      ". . . . ."
      ". . . . .";
  }

  .btn_group {
    
    display: grid;
    width: 40%;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr;
    gap: 50px;
    grid-template-areas:
      ". . .";
  }

}
</style>
